package com.lc202309;

/**
 * Description:
 *
 * @Create 2023/10/4 22:14
 * @Version 1.0
 */
public class Solution73 {
    public void setZeroes(int[][] matrix) {
        int x = matrix.length;
        int y = matrix[0].length;
        boolean[] xIndex = new boolean[x];
        boolean[] yIndex = new boolean[y];
        for (int i = 0; i < x; i++) {
            for (int j = 0; j < y; j++) {
                if (matrix[i][j] == 0) {
                    xIndex[i] = true;
                    yIndex[j] = true;
                }
            }
        }
        for (int i = 0; i < x; i++) {
            for (int j = 0; j < y; j++) {
                if (xIndex[i] || yIndex[j]) {
                    matrix[i][j] = 0;
                }
            }
        }
    }
}
